package com.sakura.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sakura.dao.ActorMapper;
import com.sakura.po.Actor;
import com.sakura.po.Admin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("actorServce")
public  class ActorServiceImpl implements ActorService{
    @Autowired
    private ActorMapper actorDao;
    @Override
    public PageInfo<Actor> queryActorAll(Actor actor,int page,int limit){
        PageHelper.startPage(page,limit);
        List<Actor> list=actorDao.queryActorAll(actor);
        PageInfo<Actor> pageInfo=new PageInfo<>(list);
        return pageInfo;
    }
    @Override
    public void addActorSubmit(Actor actor) {
        actorDao.insert(actor);
    }

    @Override
    public void updateActorSubmit(Actor actor) {
        actorDao.updateByPrimaryKeyWithBLOBs(actor);
    }

    @Override
    public Actor queryActorById(Integer id) {
        return actorDao.selectByPrimaryKey(id);
    }

    @Override
    public void deleteActorByIds(List<String> ids) {
        for(String id:ids){
            actorDao.deleteByPrimaryKey(Integer.valueOf(id));
        }
    }



}
